package com.zq.设计模式23种.创建型模式.单例模式;

/**
 * @author Jiu
 * @description：DCl模式  双重检查
 * 双重检查模式
 * @date 2020/11/24   10:58
 **/
public class SingletonDCL {

    private volatile static SingletonDCL instance;

    public SingletonDCL() {
    }

    public static SingletonDCL getInstance() {
        if (instance == null) {
            synchronized (SingletonDCL.class) {
                if (instance == null) {
                    instance = new SingletonDCL();
                }
            }
        }
        return instance;
    }
}
